{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.0016000000000000003\n",
      "1.0820365834937566\n",
      "1.082323233710861\n",
      "0.0014783014446749232\n",
      "0.9997351528562114\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "a = 0\n",
    "b = 0\n",
    "c = 0\n",
    "x = 4.0\n",
    "for i in range(5, 6):\n",
    "    a += np.power(1.0/i, x)\n",
    "for i in range(1, 11):\n",
    "    b += np.power(1.0/i, x)\n",
    "for i in range(1, 1000000):\n",
    "    c += np.power(1.0/i, x)\n",
    "print a\n",
    "print b\n",
    "print c\n",
    "print a/c\n",
    "print b/c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.13492642826362666"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = 100/1.0/68993773\n",
    "a = 1 - a\n",
    "a = np.power(a, 100000)\n",
    "1-a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "250.25025025024922"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = 0.0\n",
    "for m in range(0, 1699711):\n",
    "    a = a + np.power((1 - 2.0/1000)*(1 - 2.0/1000), m)\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "15.464139475704766"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = 0.0\n",
    "for i in range(1, 10000000):\n",
    "    a += np.power(1.0/i, 1.01)\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import matplotlib\n",
    "import numpy as np\n",
    "import urllib\n",
    "import random\n",
    "import math\n",
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "100005 2272763\n",
      "22.7264936753\n"
     ]
    }
   ],
   "source": [
    "f = open(\"C:/Users/user/Desktop/datasets/power-law-data/t1.6.txt\",\"r\")\n",
    "nodes = set()\n",
    "edges = []\n",
    "for line in f:\n",
    "    srcTar = line.strip().split()\n",
    "    src = srcTar[0]\n",
    "    tar = srcTar[1]\n",
    "    nodes.add(src)\n",
    "    nodes.add(tar)\n",
    "    edges.append((src, tar))\n",
    "print len(nodes),len(edges)\n",
    "print len(edges)/1.0/len(nodes)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.5554528650646949"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "1.202/2/1.082"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.14"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
